# Copyright 2019 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
#     http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

# NOTE: This file is auto generated by the elixir code generator program.
# Do not edit this file manually.

defmodule GoogleApi.DisplayVideo.V1.Model.Invoice do
  @moduledoc """
  A single invoice.

  ## Attributes

  *   `budgetInvoiceGroupingId` (*type:* `String.t`, *default:* `nil`) - The budget grouping ID for this invoice. This field will only be set if the invoice level of the corresponding billing profile was set to "Budget invoice grouping ID".
  *   `budgetSummaries` (*type:* `list(GoogleApi.DisplayVideo.V1.Model.BudgetSummary.t)`, *default:* `nil`) - The list of summarized information for each budget associated with this invoice. This field will only be set if the invoice detail level of the corresponding billing profile was set to "Budget level PO".
  *   `correctedInvoiceId` (*type:* `String.t`, *default:* `nil`) - The ID of the original invoice being adjusted by this invoice, if applicable. May appear on the invoice PDF as `Reference invoice number`. If replaced_invoice_ids is set, this field will be empty.
  *   `currencyCode` (*type:* `String.t`, *default:* `nil`) - The currency used in the invoice in ISO 4217 format.
  *   `displayName` (*type:* `String.t`, *default:* `nil`) - The display name of the invoice.
  *   `dueDate` (*type:* `GoogleApi.DisplayVideo.V1.Model.Date.t`, *default:* `nil`) - The date when the invoice is due.
  *   `invoiceId` (*type:* `String.t`, *default:* `nil`) - The unique ID of the invoice.
  *   `invoiceType` (*type:* `String.t`, *default:* `nil`) - The type of invoice document.
  *   `issueDate` (*type:* `GoogleApi.DisplayVideo.V1.Model.Date.t`, *default:* `nil`) - The date when the invoice was issued.
  *   `name` (*type:* `String.t`, *default:* `nil`) - The resource name of the invoice.
  *   `nonBudgetMicros` (*type:* `String.t`, *default:* `nil`) - The total amount of costs or adjustments not tied to a particular budget, in micros of the invoice's currency. For example, if currency_code is `USD`, then 1000000 represents one US dollar.
  *   `paymentsAccountId` (*type:* `String.t`, *default:* `nil`) - The ID of the payments account the invoice belongs to. Appears on the invoice PDF as `Billing Account Number`.
  *   `paymentsProfileId` (*type:* `String.t`, *default:* `nil`) - The ID of the payments profile the invoice belongs to. Appears on the invoice PDF as `Billing ID`.
  *   `pdfUrl` (*type:* `String.t`, *default:* `nil`) - The URL to download a PDF copy of the invoice. This URL is user specific and requires a valid OAuth 2.0 access token to access. The access token must be provided in an `Authorization: Bearer` HTTP header and be authorized for one of the following scopes: * `https://www.googleapis.com/auth/display-video-mediaplanning` * `https://www.googleapis.com/auth/display-video` The URL will be valid for 7 days after retrieval of this invoice object or until this invoice is retrieved again.
  *   `purchaseOrderNumber` (*type:* `String.t`, *default:* `nil`) - Purchase order number associated with the invoice.
  *   `replacedInvoiceIds` (*type:* `list(String.t)`, *default:* `nil`) - The ID(s) of any originally issued invoice that is being cancelled by this invoice, if applicable. Multiple invoices may be listed if those invoices are being consolidated into a single invoice. May appear on invoice PDF as `Replaced invoice numbers`. If corrected_invoice_id is set, this field will be empty.
  *   `serviceDateRange` (*type:* `GoogleApi.DisplayVideo.V1.Model.DateRange.t`, *default:* `nil`) - The service start and end dates which are covered by this invoice.
  *   `subtotalAmountMicros` (*type:* `String.t`, *default:* `nil`) - The pre-tax subtotal amount, in micros of the invoice's currency. For example, if currency_code is `USD`, then 1000000 represents one US dollar.
  *   `totalAmountMicros` (*type:* `String.t`, *default:* `nil`) - The invoice total amount, in micros of the invoice's currency. For example, if currency_code is `USD`, then 1000000 represents one US dollar.
  *   `totalTaxAmountMicros` (*type:* `String.t`, *default:* `nil`) - The sum of all taxes in invoice, in micros of the invoice's currency. For example, if currency_code is `USD`, then 1000000 represents one US dollar.
  """

  use GoogleApi.Gax.ModelBase

  @type t :: %__MODULE__{
          :budgetInvoiceGroupingId => String.t() | nil,
          :budgetSummaries => list(GoogleApi.DisplayVideo.V1.Model.BudgetSummary.t()) | nil,
          :correctedInvoiceId => String.t() | nil,
          :currencyCode => String.t() | nil,
          :displayName => String.t() | nil,
          :dueDate => GoogleApi.DisplayVideo.V1.Model.Date.t() | nil,
          :invoiceId => String.t() | nil,
          :invoiceType => String.t() | nil,
          :issueDate => GoogleApi.DisplayVideo.V1.Model.Date.t() | nil,
          :name => String.t() | nil,
          :nonBudgetMicros => String.t() | nil,
          :paymentsAccountId => String.t() | nil,
          :paymentsProfileId => String.t() | nil,
          :pdfUrl => String.t() | nil,
          :purchaseOrderNumber => String.t() | nil,
          :replacedInvoiceIds => list(String.t()) | nil,
          :serviceDateRange => GoogleApi.DisplayVideo.V1.Model.DateRange.t() | nil,
          :subtotalAmountMicros => String.t() | nil,
          :totalAmountMicros => String.t() | nil,
          :totalTaxAmountMicros => String.t() | nil
        }

  field(:budgetInvoiceGroupingId)
  field(:budgetSummaries, as: GoogleApi.DisplayVideo.V1.Model.BudgetSummary, type: :list)
  field(:correctedInvoiceId)
  field(:currencyCode)
  field(:displayName)
  field(:dueDate, as: GoogleApi.DisplayVideo.V1.Model.Date)
  field(:invoiceId)
  field(:invoiceType)
  field(:issueDate, as: GoogleApi.DisplayVideo.V1.Model.Date)
  field(:name)
  field(:nonBudgetMicros)
  field(:paymentsAccountId)
  field(:paymentsProfileId)
  field(:pdfUrl)
  field(:purchaseOrderNumber)
  field(:replacedInvoiceIds, type: :list)
  field(:serviceDateRange, as: GoogleApi.DisplayVideo.V1.Model.DateRange)
  field(:subtotalAmountMicros)
  field(:totalAmountMicros)
  field(:totalTaxAmountMicros)
end

defimpl Poison.Decoder, for: GoogleApi.DisplayVideo.V1.Model.Invoice do
  def decode(value, options) do
    GoogleApi.DisplayVideo.V1.Model.Invoice.decode(value, options)
  end
end

defimpl Poison.Encoder, for: GoogleApi.DisplayVideo.V1.Model.Invoice do
  def encode(value, options) do
    GoogleApi.Gax.ModelBase.encode(value, options)
  end
end
